<?php if ($this->pageCount): ?>
<div class="pagination">
    <!-- Previous page link -->
    <?php if (isset($this->previous)): ?>
    <a class="previous" href="<?php echo $this->url(array('page' => $this->previous)); ?>">Previous</a>
    <?php else: ?>
    <span class="disabled">Previous</span>
    <?php endif ?>

    <!-- Numbered page links -->
    <?php foreach ($this->pagesInRange as $page): ?>
    <?php if ($page != $this->current): ?>
        <a class="page" href="<?= $this->url(array('page' => $page)) ?>"><?= $page ?></a>
        <?php else: ?>
        <span class="selected"><?= $page ?></span>
        <?php endif ?>
    <?php endforeach; ?>

    <!-- Next page link -->
    <?php if (isset($this->next)): ?>
    <a class="next" href="<?php echo $this->url(array('page' => $this->next)); ?>">Next</a>
    <?php else: ?>
    <span class="disabled">Next</span>
    <?php endif ?>
</div>
<?php endif ?>